package cn.devil.two.utils

import org.apache.commons.lang.StringUtils

object NumberUtils {

    def str2Int(str: String) = {
      if (StringUtils.isNotEmpty(str)) {
        try {
          str.toInt
        } catch {
          case _: Exception => 0
        }
      } else 0
    }

    def str2Double(str: String) = {
      if (StringUtils.isNotEmpty(str)) {
        try {
          str.toDouble
        } catch {
          case _: Exception => 0d
        }
      } else 0d
    }
}
